package com.foreknow.service.impl;

import com.foreknow.dao.impl.AdminDaoImpl;
import com.foreknow.db.DBManager;
import com.foreknow.model.Admin;
import com.foreknow.service.AdminService;

import java.sql.Connection;
import java.sql.SQLException;

public class AdminServiceImpl implements AdminService {
    @Override
    public Admin isValidate(String username, String password) {
        DBManager dbManager = DBManager.getInstance();
        Connection conn = dbManager.getConnection();
        AdminDaoImpl adminDao = new AdminDaoImpl();
        adminDao.setConnection(conn);
        Admin admin = null;
        try {
           admin = adminDao.isCheckLogin(username,password);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return admin;
    }
}
